<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type="text/css">
    #name{border: 1px solid #dadada;height: 24px;line-height: 24px; text-align: center;width: 330px;}
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar" menu="dzgl.dzdj"/>
    <div class="mianR">
        <h3 class="yonghu">待定制详情</h3>
        <div class="chezhu-xinxi">
            <br/>
            <div class="xinxi-conter xinxi-conter1">
                <h4>定制信息</h4>
                <ul>
                    <li class="clearfix">
                        <em>定制ID</em>
                        <em class="name-text1">{$custom.id}</em>
                        <em>手机号</em>
                        <em class="name-text">{$custom.phone}</em>
                    </li>
                    <li class="clearfix">
                        <em>预算</em>
                        <em class="name-text1"><?php echo C("CUSTOM_BUDGET.".$custom['budget'])?></em>
                        <em>车型</em>
                        <em class="name-text"><?php echo C("CUSTOM_CAR_TYPE.".$custom['car_type'])?></em>
                    </li>
                    <li class="clearfix">
                        <em>渠道</em>
                        <em style="width: 875px;" class="name-text"><?php echo C("CUSTOM_COME_FROM.".$custom['comefrom'])?></em>
                    </li>
                </ul>
            </div>
        </div>
        <h3 class="yonghu">系统跟踪日志</h3>
        <div class="yonghuText">
            <ul>
                <li class="clearfix">
                    <em>项目</em>
                    <em>时间</em>
                    <em>操作人</em>
                    <em>备注</em>
                </li>
            </ul>
        </div>
        <h3 class="yonghu">登记结果</h3>
        <div class="yuyue">
            <ul>
                <li class="yuCurrent" onclick="setStatus(3);">登记成功</li>
                <li onclick="setStatus(2);">待跟踪</li>
                <li onclick="setStatus(4);">登记失败</li>
            </ul>
            <input type="hidden" id="custom_type" name="custom_type" value="3" />
        </div>
        <div class="listBox">
            <div class="yuList">
                <div class="xuanzhe">
                    <ul>
                        <li class="clearfix">
                            <span>姓名</span>
                            <input type="text" name="name" id="name" value="" placeholder="请填写姓名" />
                        </li>
                        <li>
                            <span>辆所在地</span>
                            <em class="name-text">
                                <select id="location_area" name="location_area" style="width: 144px;">
                                    <option value="0">请选择所在地</option>
                                    <option value="110000">北京</option>
                                    <option value="131082">三河</option>
                                    <option value="131000">廊坊</option>
                                    <option value="131022">固安</option>
                                    <option value="130681">涿州</option>
                                    <option value="131024">香河</option>
                                </select>
                            </em>
                        </li>
                        <li class="clearfix">
                            <span>备注</span>
                            <textarea id="success_remark" class="remark" name="success_remark" placeholder="请填写备注"></textarea>
                        </li>
                    </ul>
                </div>
                <div class="yongBtn">
                    <input class="submitForm queding" type="button" value="确定" />
                    <input type="button" onclick="history.back();"  class="quxiao" value="返回" />
                </div>
            </div>
            <div class="yuList" style="display:none;">
                <div class="xuanzhe1">
                    <ul>
                        <li class="genBtn1 clearfix">
                            <span class="gencuur"><font>电话无人接听</font><input type="checkbox" /></span>
                            <span class="gencuur"><font>电话停机或关机</font><input type="checkbox" /></span>
                            <span class="gencuur"><font>最近没时间</font><input type="checkbox" /></span>
                            <span class="gencuur"><font>直接挂断电话</font><input type="checkbox" /></span>
                        </li>
                        <li class="clearfix">
                            <span>其他原因</span>
                            <textarea id="trace_remark" class="remark" name="trace_remark" placeholder="请填写其它原因"></textarea>
                        </li>
                    </ul>
                    <input type="hidden" id="reserve_remark" name="reserve_remark" value="" >
                </div>
                <div class="yongBtn">
                    <input class="submitForm queding" type="button" value="确定"  />
                    <input type="button" onclick="history.back();"  class="quxiao" value="返回" />
                </div>
            </div>
            <div class="yuList" style="display:none;">
                <div class="xuanzhe1">
                    <ul>
                        <li class="clearfix">
                            <span>备注</span>
                            <textarea  class="remark" id="fail_remark" name="fail_remark" placeholder="请填写备注"></textarea>
                        </li>
                    </ul>
                </div>
                <div class="yongBtn">
                    <input class="submitForm queding" type="button" value="确定"  />
                    <input type="button" onclick="history.back();"  class="quxiao" value="返回" />
                </div>
            </div>
        </div>
    </div>    
</div>

<script type="text/javascript">
    $("#location_area").select2();
    /**
     * 加盟处理类型 3、成功 2、跟踪 4、失败
     */
    function setStatus(status) {
        $("#custom_type").val(status);
    }
    $("#trace_remark").blur(function () {
        var remark = $(this).val();
        if (remark != '') {
            $("#reserve_remark").val(remark);
        }
    });
    $(".genBtn1 input").click(function () {
        if ($(this).parent().hasClass("gencuur")) {
            $("#reserve_remark").val($(this).parent().find("font").text());
        } else {
            $("#reserve_remark").val('');
        }
    });
    $(".submitForm").click(function () {
        var custom_type = $("#custom_type").val();
        var name = $("#name").val();
        var addr = $("#location_area").val();
        var remark = '';
        if (custom_type == 3) {
            remark = $("#success_remark").val();
        } else if (custom_type == 2) {
            var trace_remark = $("#trace_remark").val();
            if (trace_remark == '') {
                remark = $("#reserve_remark").val();
            } else {
                remark = trace_remark;
            }
        } else if (custom_type == 4) {
            remark = $("#fail_remark").val();
        }
        var params = {
            'id': {$custom.id},
            'name':name,
            'addr':addr,
            'status': custom_type,
            'remark': remark
        }
        $.post("/Custom/do_custom_deal", params, function (data) {
            if (data.code != 200) {
                shibai_alert(data.msg);
                return false;
            }
            btn_alert(data.msg);
            setTimeout("window.location.href='/Custom/index'", 1500);
        }, "JSON");
    });
</script>
</body>
</html>